﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestListGenerator
{
    /// <summary>
    /// The types of exceptions that the TestListGenerator can
    /// throw
    /// </summary>
    public enum TestListGeneratorExceptionType
    {
        /// <summary>
        /// Thrown if a needed configuration parameter is missing
        /// </summary>
        MissingConfigurationParameter,
        /// <summary>
        /// The configuration passed in was invalid
        /// </summary>
        InvalidConfiguration,
        /// <summary>
        /// We were unable to find the Test DLL
        /// </summary>
        TestDLLMissing,
        /// <summary>
        /// The Test DLL loaded was not a .net DLL
        /// </summary>
        TestDLLInvalidFormat,
        /// <summary>
        /// The exception was of an unknown type
        /// </summary>
        Unknown
    }

    /// <summary>
    /// The exception that is thrown when the TestListGenerator encounters
    /// an exception. If the exception is of an known type, the Type will
    /// reflect that. Otherwise, it will be set to unknown
    /// </summary>
    public class TestListGeneratorException : ApplicationException
    {

        /// <summary>
        /// The type of exception thrown
        /// </summary>
        public TestListGeneratorExceptionType Type
        {
            get;
            set;
        }

        /// <summary>
        /// Throw a TestListGeneratorException
        /// </summary>
        /// <param name="type">The type of exception to throw</param>
        /// <param name="message">A message explaining the reason for the exception</param>
        public TestListGeneratorException(TestListGeneratorExceptionType type, string message) :
            base(message)
        {
            this.Type = type;
        }

        /// <summary>
        /// Throw a TestListGeneratorException
        /// </summary>
        /// <param name="type">The type of exception to throw</param>
        /// <param name="message">A message explaining the reason for the exception</param>
        /// <param name="innerException">The original exception that is the cause of the current exception</param>
        public TestListGeneratorException(TestListGeneratorExceptionType type, string message, Exception innerException) :
            base(message, innerException)
        {
            this.Type = type;
        }
    }
}
